export default function (btnValue: string) {
  if (["+", "-", "."].indexOf(btnValue[btnValue.length - 1]) >= 0) {
    return btnValue;
  }
  let result: number = 0;
  if (btnValue.indexOf("+") > 0) {
    btnValue.split("+").forEach((value, i) => {
      result += parseFloat(value);
    });
    return result.toString();
  }
  if (btnValue.indexOf("-") > 0) {
    let first = parseFloat(btnValue.split("-")[0]);
    btnValue.split("-").forEach((value, i) => {
      if (i > 0) {
        first = first - parseFloat(value);
      }
    });
    return first.toString();
  }

  return btnValue;
}
